home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF-Interest Archive / April 96 / Re Offscreen drawing.2 < prev    next >
Encoding:
Internet Message Format  |  1996-12-03  |  1.2 KB  |  [TEXT/ttxt]

  1. Subject:     Re: Offscreen drawing
  2. Sent:        4/8/96 7:19 PM
  3. Received:    4/8/96 7:31 PM
  4. From:        Mark Lanett, mlanett@meer.net
  5. Reply-To:    ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
  7.  
  8. At 0:26 PM 4/8/96, Lars Travers wrote:
  9. >Can some please point me to some ODF sample code that shows how to
  10. >create and use an offscreen buffer?
  11.  
  12. void CFrame::Draw (Environment* ev, ODFacet* odFacet, ODShape* invalidShape)
  13. {
  14.         FW_CRect bounds (FW_kZeroPoint, GetSize(ev));
  15.         FW_CPoint size = bounds.Size();
  16.         FW_CBitmap bitmap (size.IntX(), size.IntY(), 0); // 0 -> best pixel
  17. depth
  18.         {
  19.         FW_CBitmapContext bc (ev, bitmap);
  20.         FW_CRectShape::RenderRect (bc, bounds, FW_kFill,
  21. FW_kWhiteEraseInk);
  22.         // do drawing here
  23.         }
  24.  
  25.         // draw the bitmap
  26.         FW_CViewContext vc (ev, this);
  27.         FW_CBitmapShape::RenderBitmap (vc, bitmap, bounds);
  28. }
  29.  
  30. This allocates/draws/frees the bitmap on every pass through the draw
  31. method. You could easily make the bitmap be an instance of your view class
  32. or something similary (even, with a little care, fork a thread to draw in
  33. it for a period of time).
  34.  
  35. markl
  36.  
  37. --
  38. Mark Lanett, ODF
  39.  
  40.  
  41.